package me.wangshier.jms.taco.message.queue;

import java.util.concurrent.LinkedBlockingDeque;

/**
 * @Author: tongqianwen
 * @Date: 2024/12/17
 */
public class Producer implements Runnable{
    private LinkedBlockingDeque<String> queue;

    public Producer(LinkedBlockingDeque<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        int i = 0;
        while (true){
            i++;
            try{
                String msg = "message_" + i;
                queue.put(msg);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
